<!--<extend name="Public/base"/>-->

<block name="content">
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">会员列表</strong>  <small></small></div>
      </div>
      <hr>
      <form class="am-g" action="{:U('userList')}" method="get">
        <!--<div class="am-u-sm-12 am-u-md-1">-->
          <!--<div class="am-btn-toolbar">-->
            <!--<div class="am-btn-group am-btn-group-xs">-->
              <!--<a href="{:U('user/userAdd')}" type="button" class="am-btn am-btn-primary"><span class="am-icon-plus"></span>新增会员</a>-->
            <!--</div>-->
          <!--</div>-->
        <!--</div>-->
        <div class="am-u-sm-12 am-u-md-1">
          <input type="text" class="am-form-field" name="start_time"  value="{$start_time}" placeholder="开始时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',readOnly:true})" readonly/>
        </div>
        <div class="am-u-sm-12 am-u-md-1">
          <input type="text" class="am-form-field" name="end_time"  value="{$end_time}" placeholder="结束时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',readOnly:true})" readonly/>
        </div>


        <div class="am-u-sm-12 am-u-md-2">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field" name="username" value="{$username}" placeholder="用户名精确查找">
          </div>
        </div>
        <!--<div class="am-u-sm-12 am-u-md-2">-->
          <!--<div class="am-input-group am-input-group-sm">-->
            <!--<input type="text" class="am-form-field" name="truename" value="{$truename}" placeholder="姓名查找">-->
          <!--</div>-->
        <!--</div>-->
        <php>
          $leader=C('leader');
        </php>
        <div class="am-u-sm-12 am-u-md-2">
          <div class="am-form-group">
            <select  name="level" style="width: 150px">
              <option value=""  <php>if($level == '') echo 'selected'</php>>等级查找</option>
              <option value="0" <php>if($level == '0') echo 'selected'</php>>--</option>
              <option value="1" <php>if($level == '1') echo 'selected'</php>>一级代理</option>
              <option value="2" <php>if($level == 2) echo 'selected'</php>>二级代理</option>
              <option value="3" <php>if($level == 3) echo 'selected'</php>>三级代理</option>
              <option value="4" <php>if($level == 4) echo 'selected'</php>>四级代理</option>
            </select>
          </div>
        </div>
        <!--<div class="am-u-sm-12 am-u-md-2">-->
          <!--<div class="am-form-group">-->
            <!--<select  name="agent_level" style="width: 150px">-->
              <!--<option value=""  <php>if($agent_level == '') echo 'selected'</php>>全部</option>-->
              <!--<option value="0" <php>if($agent_level == '0') echo 'selected'</php>>无</option>-->
              <!--<option value="1" <php>if($agent_level == '1') echo 'selected'</php>>节点</option>-->
              <!--<option value="2" <php>if($agent_level == '2') echo 'selected'</php>>超级节点</option>-->
              <!--<option value="3" <php>if($agent_level == '3') echo 'selected'</php>>社区节点</option>-->
              <!--<option value="4" <php>if($agent_level == '4') echo 'selected'</php>>至尊节点</option>-->
            <!--</select>-->
          <!--</div>-->
        <!--</div>-->

        <!--<div class="am-u-sm-12 am-u-md-2">-->
          <!--<div class="am-form-group">-->
            <!--<select  name="is_insider" style="width: 150px">-->
              <!--<option value=""  <php>if($is_insider == '') echo 'selected'</php>>全部</option>-->
              <!--<option value="1" <php>if($is_insider == '1') echo 'selected'</php>>内部会员</option>-->
              <!--<option value="0" <php>if($is_insider == '0') echo 'selected'</php>>外部会员</option>-->
            <!--</select>-->
          <!--</div>-->
        <!--</div>-->



        <div class="am-u-sm-12 am-u-md-1">
          <div class="am-input-group am-input-group-sm">
            <input class="am-btn am-btn-primary" value="搜索" id="search" type="submit"/>
            <!--</span>-->
          </div>
        </div>

        <div class="am-u-sm-12 am-u-md-1">
          <div class="am-input-group am-input-group-sm">
            <input class="am-btn am-btn-primary" value="导出" type="submit" id="export"/>
            <!--</span>-->
          </div>
        </div>
      </form>

      <div class="am-g">
        <div class="am-u-sm-12">
          <div class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th>序号</th>
                <th class="table-title">用户账号</th>
                <th class="table-title">用户状态</th>
                <!--<th class="table-title">手机区号</th>-->
                <!--<th class="table-title">手机号</th>-->
                <th class="table-title">邮箱</th>
                <!--<th class="table-date am-hide-sm-only">姓名</th>-->
                <!--<th class="table-date am-hide-sm-only">微信号</th>-->
                <th class="table-date am-hide-sm-only">级别</th>
                <!--<th class="table-date am-hide-sm-only">代理级别</th>-->
                <!--<th class="table-date am-hide-sm-only">连锁店级别</th>-->
                <th class="table-date am-hide-sm-only">推荐人</th>
                <th class="table-date am-hide-sm-only">SWEET</th>
                <th class="table-date am-hide-sm-only">DACM</th>
                <th class="table-date am-hide-sm-only">USDT</th>
                <th class="table-date am-hide-sm-only">业绩</th>
                <th class="table-date am-hide-sm-only">资产包</th>
                <th class="table-date am-hide-sm-only">股本总数</th>
                <!--<th class="table-date am-hide-sm-only">冻结USDT</th>-->
                <!--<th class="table-date am-hide-sm-only">充值积分</th>-->
                <!--<th class="table-date am-hide-sm-only">流通积分</th>-->
                <!--<th class="table-date am-hide-sm-only">购物积分</th>-->
                <!--<th class="table-date am-hide-sm-only">兑换积分</th>-->
                <!--<th class="table-date am-hide-sm-only">WFX</th>-->
                <!--<th class="table-date am-hide-sm-only">BTC</th>-->
                <!--<th class="table-date am-hide-sm-only">USDT</th>-->
                <!--<th class="table-date am-hide-sm-only">ETH</th>-->
                <th class="table-date am-hide-sm-only">推荐人数</th>
                <!--<th class="table-date am-hide-sm-only">团队人数</th>-->
                <!--<th class="table-date am-hide-sm-only">总业绩</th>-->
                <!--<th class="table-date am-hide-sm-only">OMNI地址</th>-->
                <th class="table-date am-hide-sm-only">ETH地址</th>
                
                <!--<th class="table-date am-hide-sm-only">会员助记词</th>-->
                <th class="table-date am-hide-sm-only">注册时间</th>
                <th class="table-set">操作</th>
              </tr>
              </thead>
              <php>
                $level=C('leader');
                $agent_level=C('agent_level');
              </php>
              <tbody>
              <volist name="data" id="vo">
                <tr>
                  <td>{$key+1}</td>
                  <!--<td><a href="{:U('user_detail',array('id'=>$vo['id']))}">{$vo['username']}</a></td>-->
                  <td>{$vo['username']}</td>
                  <td>
                    <if condition="$vo.status eq 1">
                      <span style="color: dodgerblue">正常</span>
                      <else />
                      <span style="color: red">冻结</span>
                    </if>
                  </td>
                  <!--<td>+{$vo['phone_ex']}</td>-->
                  <!--<td>{$vo['phone']}</td>-->
                  <td>{$vo['email']}</td>
                  <!--<td class="am-hide-sm-only">{$vo['truename']}</td>-->
                  <!--<td class="am-hide-sm-only">{$vo['weixin']}</td>-->
                  <td>{$level[$vo['reseller_level']]}</td>
                  <!--<td>-->
                    <!--{$agent_level[$vo['agent_level']]}-->

                  <!--</td>-->
                  <!--<td>{$agent_level[$vo['agent_level']]}</td>-->
                  <!--<td>{$center_level[$vo['center_level']]}</td>-->
                  <td class="am-hide-sm-only">{$vo['higher_name']}</td>
                  <td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>1))}" title="点击充值">{$vo['z1']}</a></td>
                  <td class="am-hide-sm-only">{$vo['z2']}</td>
                  <td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>8))}" title="点击充值">{$vo['z8']}</a></td>
                  <td class="am-hide-sm-only">{$vo['zuo_zong']-$vo['z14']}</td>
                  <td class="am-hide-sm-only">{$vo['amount_usdt']}</td>
                  <td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>16))}" title="点击充值">{$vo['z16']}</a></td>
                  <!--<td class="am-hide-sm-only">{$vo['frozen_z8']}</td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>1))}" title="点击充值">{$vo['z1']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>2))}" title="点击充值">{$vo['z2']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>3))}" title="点击充值">{$vo['z3']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>4))}" title="点击充值">{$vo['z4']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>5))}" title="点击充值">{$vo['z5']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>7))}" title="点击充值">{$vo['z7']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>8))}" title="点击充值">{$vo['z8']}</a></td>-->
                  <!--<td class="am-hide-sm-only"><a href="{:U('rechargeByType',array('id'=>$vo['id'],'type'=>9))}" title="点击充值">{$vo['z9']}</a></td>-->
                  <td class="am-hide-sm-only">{$vo['tj_count']}</td>
                  <!--<td class="am-hide-sm-only"><a href="#" title="点击充值">{$vo['tuandui']}</a></td>-->
                  <!--<td class="am-hide-sm-only">{$vo['zuo_zong']}</td>-->
                  <!--<td class="am-hide-sm-only"><a href="https://omniexplorer.info/search/{$vo.usdt_address}" target="_blank">{$vo['usdt_address']}</a></td>-->
                  <td class="am-hide-sm-only"><a href="https://etherscan.io/address/{$vo.eth_address}" target="_blank">{$vo['eth_address']}</a></td>
                  
                  <!--<td class="am-hide-sm-only">{$vo['memory_word']}</td>-->


                  <td class="am-hide-sm-only">{$vo['create_time']|date="Y-m-d H:i:s",###}</td>
                  <td>
                    <div class="am-btn-toolbar">
                      <div class="am-btn-group am-btn-group-xs">
                        <!--<a  href="{:U('userEdit',array('id'=>$vo['id']))}" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span>查看详细</a>&nbsp;&nbsp;-->
                        <a  href="#" data-id="{$vo['id']}" class="am-btn am-btn-default am-btn-xs am-text-secondary change-ps"><span class="am-icon-pencil-square-o"></span>重置登录密码123456</a>&nbsp;&nbsp;
                        <!--<a  href="#" data-id="{$vo['id']}" class="am-btn am-btn-default am-btn-xs am-text-secondary change-ps2"><span class="am-icon-pencil-square-o"></span>重置支付密码123456</a>&nbsp;&nbsp;-->
                        <a  href="{:U('userFront',array('id'=>$vo['id']))}" target="_blank">登入前台</a>&nbsp;&nbsp;
                        <!--<a  href="{:U('modeLevel',array('id'=>$vo['id']))}">设置领导人</a>&nbsp;&nbsp;-->
                        <!--<a  href="{:U('modeAgent',array('id'=>$vo['id']))}">设置代理商</a>&nbsp;&nbsp;-->
                        <!--<button class="insider" uid="{$vo.id}">设定内部人</button>&nbsp;&nbsp;-->
                        <button class="frozen" uid="{$vo.id}">冻结用户</button>
                        <button class="unfrozen" uid="{$vo.id}">解除冻结用户</button>

                        <a  href="javascript:" class="del" user_id={$vo['id']} class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span>删除</a>
                      </div>
                    </div>
                  </td>
                </tr>
              </volist>
              </tbody>
            </table>
            <div class="am-cf">
              共 {$count} 条记录
              <div class="am-fr">
                <ul class="am-pagination">
                  {$show}
                </ul>
              </div>
            </div>
            <hr />
        </div>

      </div>
    </div>
  </div>

</block>


<block name="js">

  <script>
    $(function () {
        var url = "{:U('activeUser')}";
        $('.useractive').click(function () {
            $.post(url,{user_id:$(this).attr('user_id')},function (data) {
                layer.msg(data.msg,{time:1000},function () {
                    if(data.code){
                        return false;
                    }else{
                        window.location.href="{:U('User/userlist')}";
                    }
                })
            },'json')
        });


        var url1 = "{:U('dongjie')}";
        $('.dongjie').click(function () {
            $.post(url1,{id:$(this).attr('user_id')},function (data) {
                layer.msg(data.msg,{time:1000},function () {
                    if(data.code){
                        return false;
                    }else{
                        window.location.href=data.data;
                    }
                })
            },'json')
        });

        $('#pro').change(function(){
            $.ajax({
                type:"post",
                url:"{:U('Public/area_choose')}",
                data:'pro_id='+$('#pro').val(),
                dataType:"json",
                success:function(data){
                    $('#city').html(data);
                }
            });
        });

        var searchurl = "{:U('userList')}";
        $('#search').click(function () {

            $('form').attr('action',searchurl);
        });

        //重置密码
        $('.change-ps').click(function(){
            $.ajax({
                type:"post",
                url:"{:U('changePassword')}",
                data: {
                    'userId': $(this).attr('data-id')
                },
                dataType:"json",
                success:function(data){
                    alert(data.msg);
                    if(data.code == 1)
                    {
                        window.location.reload();
                    }
                }
            });
        });

        $(".insider").click(function () {
            // alert($(this).attr('uid'))
            if(confirm('确认设定该用户为内部人吗')){
                $.ajax({
                    type:"post",
                    dataType:"json",
                    url:"{:U('modeInsider')}",
                    data:{
                        id:$(this).attr('uid'),
                    },
                    success:function (data) {
                        if(data.code>0){
                            alert(data.message);
                            window.location.reload();
                        }else {
                            alert(data.message);
                        }
                    }
                })
            }
        })

        $(".frozen").click(function () {
            if (confirm('确认冻结此用户吗')){
                $id=$(this).attr('uid');
                $.ajax({
                    type:"post",
                    dataType:"json",
                    url:"{:U('user/frozen')}",
                    data:{
                        uid:$id,
                    },
                    success:function (data) {
                        if(data.code>0){
                            alert(data.msg);

                        }else {
                            alert(data.msg);
                            window.location.reload();
                        }
                    }
                })
            } else {
                return false;
            }
        })
        
        $(".unfrozen").click(function () {
            if (confirm('确认解冻此用户吗')){
                $id=$(this).attr('uid');
                $.ajax({
                    type:"post",
                    dataType:"json",
                    url:"{:U('user/unfrozen')}",
                    data:{
                        uid:$id,
                    },
                    success:function (data) {
                        if(data.code>0){
                            alert(data.msg);

                        }else {
                            alert(data.msg);
                            window.location.reload();
                        }
                    }
                })
            } else {
                return false;
            }
        })

      //重置支付密码
      $('.change-ps2').click(function(){
        $.ajax({
          type:"post",
          url:"{:U('changePassword2')}",
          data: {
            'userId': $(this).attr('data-id')
          },
          dataType:"json",
          success:function(data){
            alert(data.msg);
            if(data.code == 1)
            {
              window.location.reload();
            }
          }
        });
      });

        var exporturl = "{:U('exportuser')}";
        $('#export').click(function () {

            $('form').attr('action',exporturl);
        });

        var url11 = "{:U('deleteUser')}";
        $('.del').click(function () {

            if(confirm('确认删除此会员吗?')){
                $.post(url11,{id:$(this).attr('user_id')},function (data) {
                    layer.msg(data.msg,{time:1000},function () {
                        if(data.code){
                            return false;
                        }else{
                            window.location.href=data.data;
                        }
                    })
                },'json')
            }

        });
    })
  </script>
</block>